<template>
	<!-- 一级路由我的下面的 二级路由投诉与建议 -->
	<view>
			<global-navgation title="投诉与建议"></global-navgation>
			<view class="text-container">
				<textarea value="" placeholder="请输入建议/投诉内容" />
				</view>
			
			<view class="img-container">
				<view class="img-list">
				<view class="img-item" v-for="(v,i) in imgArr" :key="i">
					<view class="item-content">
						<view class="iconfont icon-shanchu icon" @click="deleteImg(i)"></view>
						<image :src="v" lazy-load="true" @click="previewImg(v)"></image>
					</view>
				</view>
				
				
				<view class="img-item" @click="chooseImg()">
					<view class="iconfont icon-ziyuan icon"></view>
				</view>
			    </view>
			</view>
			
			<view class="submit">
				<button type="default" @click="skipComplaint">提交</button>
			</view>
		</view>
</template>

<script>
	import globalNavgation from '../../../components/globalNavgation.vue'
		export default {
			components:{
				globalNavgation
			},
			data() {
				return {
					imgArr:[],
					lists:[]
				}
			},
			methods: {
				skipComplaint(){
					uni.navigateTo({
						url:'complaintSussess'
					})
				},
				chooseImg(){
					uni.chooseImage({
						count:6,
						sizeType: ['original', 'compressed'], 
						    sourceType: ['album'], 
						    success: res =>{
								if(this.imgArr.length===0){
									this.imgArr = res.tempFilePaths
									console.log(res.tempFilePaths[0])
								}else{
									this.imgArr.push(...res.tempFilePaths)
								}
						    }
					})
				},
				deleteImg(i){
					this.imgArr.splice(i,1)
				},
				previewImg(v){
					uni.previewImage({
						current:v,
						urls:this.imgArr,
						loop:true
					})
				}
			}
		}
</script>

<style scoped>
.text-container{
	margin: 0 auto;
	width: 690rpx;
	height: 300rpx;
}
.text-container textarea{
	width: 100%;
	padding-top: 48rpx;
	font-family: PingFang SC;
	font-style: normal;
	font-weight: normal;
	font-size: 32rpx;
	letter-spacing: -0.408px;
	color: rgba(0, 0, 0, 0.25);
}

.img-container{
	width: 100%;
	margin-top: 44rpx;
}

.img-container .img-list{
	width: 690rpx;
	height: 326rpx;
	margin: 0 auto;
	display: flex;
	flex-flow: row wrap;
}

.img-container .img-list .img-item{
	width: 144rpx;
	height: 144rpx;
	margin-right: 38rpx;
	margin-bottom: 38rpx;
}

.img-container .img-list .img-item:nth-child(4n){
	margin-right: 0rpx;
}

.img-container .img-list .img-item .item-content{
	width: 100%;
	height: 100%;
	position: relative;
}

.img-container .img-list .img-item .item-content .icon{
	color: #EB5757;
	position: absolute;
	z-index: 1;
	font-size: 36rpx;
	top: -18rpx;
	right: -18rpx;
}

.img-container .img-list .img-item .item-content image{
	width: 100%;
	height: 100%;
	vertical-align: top;
}

.img-container .img-list .img-item:last-child{
	width: 144rpx;
	height: 144rpx;
	border: 1px solid rgba(0, 0, 0, 0.1);
	box-sizing: border-box;
	border-radius: 4px;
	text-align: center;
	line-height: 144rpx;
	margin-top: 0;
}

.img-container .img-list .img-item .icon{
	font-size: 60rpx;
	color: rgba(0, 0, 0, 0.25);
}

.submit{
	width: 100%;
	height: 140rpx;
	position: absolute;
	bottom: 0;
	box-shadow: 0px -2px 8px rgba(0, 0, 0, 0.08);
}
.submit button{
	margin-top: 20rpx;
	width:686rpx;
	height: 100rpx;
	text-align: center;
	line-height: 100rpx;
	font-family: PingFang SC;
	font-style: normal;
	font-weight: normal;
	font-size: 36rpx;
	color: #F7F7F7;
	background: linear-gradient(90deg, #3965FF 0%, rgba(57, 101, 255, 0.8) 100%);
	border-radius: 4px;
}
</style>